﻿@{
    Layout = null;
}
@using hc.epm.Common;
@using hc.Plat.Common.Extend;
<!DOCTYPE html>
<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <link rel="stylesheet" href="/Resource/css/base.css" />
</head>
<body>
    <div class="contentData">
        <form id="mainForm" class="ComBim">
            <div class="tab" style="padding:0">
                <input type="hidden" name="BIMAddress" id="BIMAddress" value="@ViewBag.BIMAddress" />
                <div class="intro" style="height:700px">
                    <div><label>&nbsp;查看模型&nbsp;:</label></div>
                    <div>
                        <div class="model" style="position:relative;margin-top:20px;height:680px">
                            <div id="webglContainer" style="height:100%;width:100%"></div>
                            <div class="loading" style="display:none;position:relative">
                                <div>
                                    <img src='/Resource/images/moxing.jpg' style='width:100%;height:100%' />
                                </div>
                                <div style='position:absolute;top:250px;left:400px;color:red'><h3 style='font-size:24px'>模型正在轻量化中...</h3></div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </form>
    </div>
    <script type="text/javascript" src="/Resource/scripts/jquery-1.10.2.min.js"></script>
    <script type="text/javascript" src="/Resource/scripts/comm.js"></script>
    <script type="text/javascript" src="/Resource/scripts/global.js"></script>
    <script type="text/javascript" src="/Resource/plugins/layui-2.1.2/layui.js"></script>
    <script type="text/javascript" src="/Resource/scripts/3dEngine.js"></script>
    <script>
        EngineInit("webglContainer"); //初始化画布
        SetClickMode(2);//点击模式设置
        var ids;
        //模型加载
        function init(detailId, bimId) {
            $.post("/Monitor/GetMonitorComponentList", { detailId: detailId, bimId: bimId }, function (data) {
                if (data == "" || data == null) {
                    $(".loading").show();
                    $(".loading").prev().hide();
                } else {
                    $(".loading").hide();
                    $(".loading").prev().show();
                    var id = data[0].ComponentId.split("_")[0];
                    var file = BimFileURL + $("#BIMAddress").val();
                    AddModel(file, id);//添加模型
                    setColor(data);
                }
            });
        }
        //模型加载完成监听事件
        function OnLoadModelEnd(guid) {
            SetActorColor(ids, 0, 0, 255);
        }
        //选取颜色
        function setColor(data) {
            var idsArray = [];
            $.each(data, function (index, item) {
                var id = data[index].ComponentId;
                idsArray.push(id);
            })
            ids = idsArray.join("#");
            ids = ids.toString()
        }

    </script>
</body>
</html>
